<!--
 * @Author: wang_sheshe
 * @Date: 2021-05-24 16:18:15
 * @LastEditTime: 2021-07-10 15:56:10
 * @Description: 智能表计数据
-->
<template>
    <div id="bileiqi_page">
        <!-- 折叠面板 -->
        <div class="table">
            <div class="content">
                <div class="title-first">
                    <div class="left">设备名称：<span>{{deviceInfo.deviceName}}</span></div>
                    <div class="right">相别：<span>A</span></div>
                </div>
                <div class="title-first">智能表计：</div>
            </div>
            <van-cell-group :border="false">
                <van-cell v-for="(item, index) in intelligentList" :key="index" :title="item.smartMeterName" :value="item.smartMeterCode">
                    <template slot="right-icon">
                        <div>{{item.smartMeterValue}}</div>
                    </template>
                </van-cell>
            </van-cell-group> 
        </div>
    </div>
</template>
<script type="text/javascript">
import {getIntelligentMeter} from '../../api/tourTask';
export default {
    name: "bileiqiCopy",
    components: {
       
    },
    props:{
        deviceinfo:{
            type:Object,
            default: function() {
                return {}
            }
        }
    },
    data() {
        return {
            // 智能表计绑定的数据
            text:"",
            intelligentList: [],
            userInfo:{},
            deviceInfo:this.deviceinfo,
        }
    },

    methods: {
         /**
         * @description: 获取指定设备表记数据
         * @param {*}
         * @return {*}
         */
         getIntelligentMeter() {
            var self = this;
            var params = {
                deviceId: "175680146",//巡视任务id
                //deviceId: this.deviceInfo.deviceId,//设备类型
                userId: this.userInfo.userId,//用户id
                roleCode: "",//用户角色
            }
            this.$Toast.loading({
                    duration: 0,//展示时长 0不会消失
                    message: "巡视设备物理参数获取中...",
                    forbidClick: true,//是否禁止背景点击
                    overlay: true//是否显示背景遮罩层
                })
            getIntelligentMeter(params).then(data => {
                self.$Toast.clear();
                if(data.success) {
                    self.$Toast.success(data.msg)
                    self.intelligentList = data.data;//试验记录表
                }else{
                    self.$Toast.fail(data.msg)
                }
            }).catch(err => {
                self.$Toast.fail(err)
            })
        },
    },
    created(){
        var userInfo = localStorage.getItem("userInfo");
		this.userInfo = JSON.parse(userInfo);
        this.getIntelligentMeter();
    },
    mounted() {
        
    },
}
</script>
<style scoped>
#bileiqi_page {
    width: 100%;
    height: 100%;   
    padding-bottom: 0;
    background: #fff;
}
#bileiqi_page /deep/ .van-field__label {
    width: 120px;
}
.line {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.line .unit {
    width: 20px;
}
.padding_div{
    padding: 10px 16px;
    color: #646566;
}
.table{
    padding-top: 10px;
}
.content{
    background:#fafafa;
    margin-left: 10px;
    margin-right: 10px;
    padding: 5px;
    border-radius: 5px;
}
.title-first{
    font-size: 14px;
    display: flex;
    padding: 5px;
}
.title-first .left{
    width: 70%;
}
.title-first .right{
   flex:1; 
   text-align: right;
}
</style>